<template>
  <div>
    <li v-for="(item, index) in titleList" :key="index">
      <van-cell
        :title="item.title"
        is-link
        @click="gotoDetails(item)"
      ></van-cell>
    </li>
  </div>
</template>
<script>
import { newsApi } from "@/api";
export default {
  name: "cell-list",
  props: {
    titleList: {
      type: Array,
      default: () => []
    }
  },
  methods: {
    gotoDetails(item) {
      newsApi({
        pid: item.token
      }).then(res => {
        if (res.code == 200) {
          if (res.data.length > 0) {
            this.$router.push('/aboutus/list/'+item.token);
          } else {
            this.$router.push('/aboutus/details/'+item.token);
          }
        }
      });
    }
  }
};
</script>
<style scoped lang="less"></style>
